// Copyright (C) joyinter
// All rights reserved.
// 
// Author : Jiang Li
// Date   : 2004-8-13

#ifndef __GAMESETTING_H_CLIENT_MAIN__
#define __GAMESETTING_H_CLIENT_MAIN__

#pragma once

#include <common\ui\wnd.h>
#include <common\ui\button.h>
#include <common\ui\edit.h>
#include <common\base\tinyxml.h>

class CJoyLobbyIndex;
class CJoyLobbyItem;
class CJoySettingDlg;
class CJoyHtmlPanel;

//##ModelId=44C4B5E3007D
class CJoyGameSetting :
    public CJoyWnd
{
	DECLARE_DYNAMIC(CJoyGameSetting)

public:
	//##ModelId=44C4B5E3013B
    class CLobbyInfo
    {
    public:
		//##ModelId=44C4B5E30148
        CString m_path;
		//##ModelId=44C4B5E30149
        CString m_para;
    };

	//##ModelId=44C4B5E3008D
    CJoySettingDlg* m_topDlg;

	//##ModelId=44C4B5E30092
    CJoyLobbyIndex* m_lobbyIndex;
	//##ModelId=44C4B5E30097
    CJoyLobbyItem*  m_currItem;

	//##ModelId=44C4B5E3009D
    CJoyButton* m_btnOK;
	//##ModelId=44C4B5E300A2
    CJoyButton* m_btnCancel;
	//##ModelId=44C4B5E300AC
    CJoyButton* m_btnBrowse;
	//##ModelId=44C4B5E300B1
    CJoyButton* m_btnFind;

	//##ModelId=44C4B5E300B6
    CJoyEdit*   m_editPath;
	//##ModelId=44C4B5E300BC
    CJoyEdit*   m_editPara;

	//##ModelId=44C4B5E300C1
    CJoyXmlFile m_confFile;
	//##ModelId=44C4B5E300CC
    CJoyXmlElement* m_lobbyElem;
	//##ModelId=44C4B5E300D1
    CJoyHtmlPanel*  m_helpNote;

	//##ModelId=44C4B5E300D5
    bool    m_modified;

	//##ModelId=44C4B5E300DA
    void WriteCurrentItem();
	//##ModelId=44C4B5E300DB
    void WriteAttribute(CJoyXmlAttribute* pAttrib, const CString& strValue);
	//##ModelId=44C4B5E300EB
    void ReadLobbyInfo(UINT lobbyId, CLobbyInfo& info);
	//##ModelId=44C4B5E300FA
    void WriteLobbyInfo(UINT lobbyId, const CLobbyInfo& info);

	//##ModelId=44C4B5E3010A
    void OnSelLobbyItem(CJoyLobbyItem* item);
	//##ModelId=44C4B5E30119
    void CM_BtnClick(CJoyButton*);
public:
	//##ModelId=44C4B5E3011B
    CJoyGameSetting(void);
	//##ModelId=44C4B5E3011D
    virtual ~CJoyGameSetting(void);

	//##ModelId=44C4B5E3012A
    void EndDlg(int r);
	//##ModelId=44C4B5E3012C
    void SaveSetting();
public:
    DECLARE_MESSAGE_MAP()
	//##ModelId=44C4B5E30138
    afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
};

#endif  // __GAMESETTING_H_CLIENT_MAIN__
